{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1 1 0 0]\n",
      " [1 3 0 0]\n",
      " [0 0 3 1]\n",
      " [0 0 2 1]]\n",
      "2.0\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import numpy.linalg as npl\n",
    "\n",
    "# A=np.ar\n",
    "A = np.array([[1, 1, 0, 0], [1, 3, 0, 0], [0, 0, 3, 1], [0, 0, 2, 1]])\n",
    "detA=npl.det(A)       \n",
    "B=np.array([[1,0],[0,1]])\n",
    "detB=npl.det(B)\n",
    "\n",
    "print(A)\n",
    "print(detA)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1 1 0 0]\n",
      " [0 2 0 0]\n",
      " [0 0 1 0]\n",
      " [0 0 2 1]]\n",
      "2.0\n"
     ]
    }
   ],
   "source": [
    "A1 = A.copy()\n",
    "A1[1]\n",
    "A1[1] -= A1[0]\n",
    "A1[2] -= A1[3]\n",
    "\n",
    "\n",
    "print(A1)\n",
    "print(npl.det(A1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1 0]\n",
      " [0 1]]\n",
      "1.0\n",
      "[[1 1]\n",
      " [0 1]]\n",
      "1.0\n",
      "[[ 1  1]\n",
      " [10 11]]\n",
      "1.0000000000000009\n"
     ]
    }
   ],
   "source": [
    "print(B)\n",
    "print(detB)\n",
    "\n",
    "B1 = B.copy()\n",
    "\n",
    "B1[0] += B1[1]\n",
    "print(B1)\n",
    "print(npl.det(B1))\n",
    "B1[1] += 10*B1[0]\n",
    "print(B1)\n",
    "print(npl.det(B1))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "ML",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.19"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
